function [ref_x,ref_y,ref_theta] = path_generation(theta,center,radius,adjust)
% 生成圆的坐标
x = center(1) + radius * cos(theta);
y = center(2) + radius * sin(theta);

% 中心化和缩放
x_mean = mean(x);
y_mean = mean(y);
x_std = std(x);
y_std = std(y);

x_circle_scaled = (x - x_mean) / x_std;
y_circle_scaled = (y - y_mean) / y_std;

% 多项式拟合缩放后轨迹
degree = 17;%16-19
poly_scaled = polyfit(x_circle_scaled, y_circle_scaled, degree);

% 多项式拟合恢复缩放前轨迹
degree = 13;%13
x_circle_unscaled = linspace(x_circle_scaled(1), x_circle_scaled(end), 1000);%1000
y_circle_unscaled = polyval(poly_scaled, x_circle_unscaled) * y_std + y_mean;
x_circle_unscaled = x_circle_unscaled * x_std + x_mean;
poly = polyfit(x_circle_unscaled, y_circle_unscaled, degree);

% 生成拟合的轨迹
ref_seq = linspace(x_circle_unscaled(1), x_circle_unscaled(end), 150);% 点越密集，对输入要求越小
ref_theta_seq = adjust + atan2(polyval(polyder(poly), ref_seq),1);% 偏航角
ref_theta_seq = angle_bound(ref_theta_seq);
ref_x = ref_seq; % 参考轨迹的x坐标
ref_y = polyval(poly, ref_seq); % 参考轨迹的y坐标
ref_theta = ref_theta_seq; % 参考轨迹的偏航角
end

